package inheritance;

import com.sun.xml.internal.ws.api.ha.StickyFeature;

import java.util.Arrays;

public class happy {
    public static void main(String[] args) {
        Manage happy = new Manage();
        System.out.println("happy.getSalary() = " + happy.getSalary());

        Employee employee = new Manage();
        Employee employee1 = new Employee();
        System.out.println("employee.getSalary() = " + employee.getSalary());

        Object o = new Manage();
//        Employee employee1 = (Employee) o;
        System.out.println("employee1.getSalary() = " + employee1.getSalary());

        Manage manage = (Manage) o;
        System.out.println("manage.getSalary() = " + manage.getSalary());
        System.out.println("employee.getClass().getName() = " + employee1.getClass().getName());
        System.out.println("manage.getClass().getName() = " + manage.getClass().getName());

        String s1 = "a";
        String s2 = s1;
        String s3 = "a";
        int[] a = {1,2,3};
        System.out.println("Arrays.hashCode(a) = " + Arrays.hashCode(a));
        System.out.println("Arrays.toString(a) = " + Arrays.toString(a));
        System.out.println("employee.toString() = " + "123:"+employee);
        System.out.println("manage.toString() = " + manage.toString());

        System.out.println("s1 == s2 = " + (s1 == s2));
        System.out.println("s1.equals(s2) = " + s1.equals(s2));
        System.out.println("s1.equalsIgnoreCase(s2) = " + s1.equalsIgnoreCase(s3));
        System.out.println("*************************************************************************");
        String n1 = new String("abcd");
        System.out.println("(n1+n1.hashCode()) = " + (n1 +'\t'+ n1.hashCode()));
        String n2 = new String("abcd");
        System.out.println("(n2+n2.hashCode()) = " + n2+'\t'+n2.hashCode());
        String n3 = n1;
        System.out.println("(n1==n2) = " + (n1 == n2));
        System.out.println("(n1==n3) = " + (n1 == n3));
        Object o1 = (Object) n1;
        Object o2 = (Object) n2;
        System.out.println("(o1==o2) = " + (o1 == o2));
        System.out.println("o1.equals(o2) = " + o1.equals(o2)); // 多态
        System.out.println("n1.equals(n2) = " + n1.equals(n2));
        System.out.println("*****************************************************************************");
        System.out.println("o1.equals(n1) = " + o1.equals(n1));
        System.out.println("n1.equals(o1) = " + n1.equals(o1));


    }
}
